home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / exec / addport.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  2KB  |  82 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: addport.c,v 1.5 1996/10/24 15:50:42 aros Exp $
  4.     $Log: addport.c,v $
  5.     Revision 1.5  1996/10/24 15:50:42  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.4  1996/08/13 13:55:56  digulla
  9.     Replaced AROS_LA by AROS_LHA
  10.     Replaced some AROS_LH*I by AROS_LH*
  11.     Sorted and added includes
  12.  
  13.     Revision 1.3  1996/08/01 17:41:02  digulla
  14.     Added standard header for all files
  15.  
  16.     Desc:
  17.     Lang: english
  18. */
  19. #include <exec/ports.h>
  20. #include <exec/execbase.h>
  21. #include <aros/libcall.h>
  22.  
  23. /*****************************************************************************
  24.  
  25.     NAME */
  26.     #include <clib/exec_protos.h>
  27.  
  28.     AROS_LH1(void, AddPort,
  29.  
  30. /*  SYNOPSIS */
  31.     AROS_LHA(struct MsgPort *, port, A1),
  32.  
  33. /*  LOCATION */
  34.     struct ExecBase *, SysBase, 59, Exec)
  35.  
  36. /*  FUNCTION
  37.     Add a port to the public port list. The ln_Name and ln_Pri fields
  38.     must be initialized prior to calling this function, while
  39.     the port itself is reinitialized before adding. Therefore it's
  40.     not allowed to add an active port.
  41.  
  42.     INPUTS
  43.     port - Pointer to messageport structure.
  44.  
  45.     RESULT
  46.  
  47.     NOTES
  48.  
  49.     EXAMPLE
  50.  
  51.     BUGS
  52.  
  53.     SEE ALSO
  54.  
  55.     INTERNALS
  56.  
  57.     HISTORY
  58.  
  59. ******************************************************************************/
  60. {
  61.     AROS_LIBFUNC_INIT
  62.  
  63.     /* Yes, this is a messageport */
  64.     port->mp_Node.ln_Type=NT_MSGPORT;
  65.  
  66.     /* Clear the list of messages */
  67.     port->mp_MsgList.lh_Head=(struct Node *)&port->mp_MsgList.lh_Tail;
  68.     port->mp_MsgList.lh_Tail=NULL;
  69.     port->mp_MsgList.lh_TailPred=(struct Node *)&port->mp_MsgList.lh_Head;
  70.  
  71.     /* Arbitrate for the list of messageports. */
  72.     Forbid();
  73.  
  74.     /* And add the actual port */
  75.     Enqueue(&SysBase->PortList,&port->mp_Node);
  76.  
  77.     /* All done */
  78.     Permit();
  79.     AROS_LIBFUNC_EXIT
  80. } /* AddPort */
  81.  
  82.